#include<iostream>
#include<string>
#include<memory>
#include"Log.hpp"
#include"HttpServer.hpp"


static void Usage(const std::string proc) {
    std::cout << "Usage: " << "proc" << std::endl;
    std::cout << "You need two parameters, IP and Port!!!" << std::endl;
}

int main(int argc, char* argv[]) {

    if (argc != 2) {
        Usage(argv[0]);
        exit(4);
    }

    int port = atoi(argv[1]);
    //用智能指针去保存，自动回收内存空间
    std::shared_ptr<HttpServer> http_server(new HttpServer(port));

    http_server->InitServer();
    http_server->Loop();

    return 0;
}
